package com.bestcem.xm.user.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.stream.Stream;

/**
 * 用户埋点数据来源枚举
 *
 * @author qiongyu.cui <qiongyu.cui@idiaoyan.com>
 * @version v1.0
 * @date 2022/3/17 16:27
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum UserBookingTrackPlatformEnum {

    /**
     * 用户埋点数据来源枚举
     */
    FREE_WEB(0, "网页免费版"),
    PRO_FESSIONAL_WEB(1, "网页专业版"),
    WX_MINI_PROGRAM(2, "微信小程序"),
    WX_OFFI_ACCOUNT(3, "微信公众号");

    /**
     * 类型
     */
    private Integer type;
    /**
     * 状态描述
     */
    private String desc;

    /**
     * 根据type获取枚举
     *
     * @param type 类型
     * @return com.bestcem.xm.user.enums.UserBookingTrackPlatformEnum
     * @author cuiqiongyu <qiongyu.cui@idiaoyan.cn>
     * @date 2022/06/02 17:06
     */
    public static UserBookingTrackPlatformEnum getByType(Integer type) {
        return Stream.of(values()).filter(u -> u.getType().equals(type)).findFirst().orElse(null);
    }

}
